home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Win '95 Giga Pack
/
Win95 Giga Pack (Maple Media) (1997).iso
/
EDITOR32
/
DANA104
/
WORDWRAP.DAS
< prev
Wrap
Text File
|
1995-12-15
|
2KB
|
86 lines
'-----------------------------------------------------------------------
' Re-format text.
'-----------------------------------------------------------------------
Main ()
Dim s$, t$
Dim n%
Dim c%
Dim i%, j%
n = .BlkBegC
s$ = GetSelected()
t$ = s$
While True
c = LodB(s$, i)
If c = &H0A Then
Dim cc%
cc = LodB(s$, i + 1)
If i > 1 Then
Dim ii%
ii = i - 2;
If cc <> &H00 Then
Do
cc = LodB(s$, ii)
ii = ii - 1
Loop Until cc <> &H20 And ii >= 0
Else
cc = &H0A
End If
Else
cc = &H20
End If
' Not ".", "!", "?", CRLF
If .SprPoint > n And cc <> &H2E And cc <> &H0A And cc <> &H21 And cc <> &H3F Then
c = &H20
Else
n = 0
End If
StoB(t$, j, c)
j = j + 1
Else If c = &H20 Or c = &H09 Then
c = &H20
If .SprPoint <= n Then
c = &H0A
n = 0
End If
StoB(t$, j, c)
j = j + 1
Else If c = &H0D Then
n = n - 1
' Do nothing.
Else
If n >= .SprPoint Then
Dim nn%, jj%, cc%
jj = j - 1
nn = n
While nn
cc = LodB(t$, jj)
If cc = &H20 Then
StoB(t$, jj, &H0A)
n = n - nn
Exit While
End If
jj = jj - 1
nn = nn - 1
Wend
End If
StoB(t$, j, c)
j = j + 1
End If
If c = &H00 Then Exit While
If c = &H20 Then
Dim cc%
If j > 1 Then
cc = LodB(t$, j-2)
End If
If n = 1 Or cc = &H20 Then
j = j - 1
n = n - 1
End If
End If
n = n + 1
i = i + 1
Wend
DelSelect()
InsertString(t$)
End